<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>使用 switch 语句</title>
</head>
<body>
<script>
    var secretNumber = prompt('Pick a number between 1 and 5:', '');
    secretNumber = parseInt(secretNumber, 10);

    switch (secretNumber) {
        case 1:
            document.write('Too low!');
            break;
        case 2:
            document.write('Too low!');
            break;
        case 3:
            document.write('Too guessed the secret number!');
            break;
        case 4:
            document.write('Too high!');
            break;
        case 5:
            document.write('Too high!');
            break;
        default:
            document.write('You did ont enter a number between 1 and 5.');
            break;
    }

    document.write('<br/>Execution continues here');
</script>
<br/>
<script>

    var secretNumber = prompt('Pick a number between 1 and 5:', '');
    secretNumber = parseInt(secretNumber, 10);
    switch (secretNumber) {
        case 1:
        case 2:
            document.write('Too low!');
            break;
        case 3:
            document.write('Too guessed the secret number!');
            break;
        case 4:
        case 5:
            document.write('Too high!');
            break;
        default:
            document.write('You did ont enter a number between 1 and 5.');
            break;
    }
    document.write('<br/>Execution continues here');
</script>
</body>
</html>